package com.egdd.video.service.iml;

import com.egdd.video.mapper.AudiocategoryMapper;
import com.egdd.video.pojo.Audiocategory;
import com.egdd.video.service.IAudioCategoryService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AudioCategoryServiceImpl implements IAudioCategoryService {
    @Autowired(required = false)
    AudiocategoryMapper audiocategoryMapper;

    @Override
    public List<Audiocategory> getAllAudiocategory() {
        return audiocategoryMapper.getAll();
    }

    @Override
    public List<Audiocategory> getAllAudiocategoryByPage(int page, int pageSize) {
        PageHelper.startPage(page,pageSize);
        return audiocategoryMapper.getAll();
    }

    @Override
    public int delAudiocategoryById(int id) {
        return audiocategoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int addAudiocategory(Audiocategory audiocategory) {
        return audiocategoryMapper.insert(audiocategory);
    }
}
